package com.recycle.system.service.impl;

import java.util.List;
import com.recycle.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.recycle.system.mapper.OrderItemMapper;
import com.recycle.system.domain.OrderItem;
import com.recycle.system.service.IOrderItemService;

/**
 * 订单资源Service业务层处理
 *
 * @author recycle
 * @date 2023-04-19
 */
@Service
public class OrderItemServiceImpl implements IOrderItemService
{
    @Autowired
    private OrderItemMapper orderItemMapper;

    /**
     * 查询订单资源
     *
     * @param orderItemId 订单资源主键
     * @return 订单资源
     */
    @Override
    public OrderItem selectOrderItemByOrderItemId(Long orderItemId)
    {
        return orderItemMapper.selectOrderItemByOrderItemId(orderItemId);
    }

    /**
     * 查询订单资源列表
     *
     * @param orderItem 订单资源
     * @return 订单资源
     */
    @Override
    public List<OrderItem> selectOrderItemList(OrderItem orderItem)
    {
        return orderItemMapper.selectOrderItemList(orderItem);
    }

    /**
     * 新增订单资源
     *
     * @param orderItem 订单资源
     * @return 结果
     */
    @Override
    public int insertOrderItem(OrderItem orderItem)
    {
        orderItem.setCreateTime(DateUtils.getNowDate());
        return orderItemMapper.insertOrderItem(orderItem);
    }

    /**
     * 修改订单资源
     *
     * @param orderItem 订单资源
     * @return 结果
     */
    @Override
    public int updateOrderItem(OrderItem orderItem)
    {
        orderItem.setUpdateTime(DateUtils.getNowDate());
        return orderItemMapper.updateOrderItem(orderItem);
    }

    /**
     * 批量删除订单资源
     *
     * @param orderItemIds 需要删除的订单资源主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemByOrderItemIds(Long[] orderItemIds)
    {
        return orderItemMapper.deleteOrderItemByOrderItemIds(orderItemIds);
    }

    /**
     * 删除订单资源信息
     *
     * @param orderItemId 订单资源主键
     * @return 结果
     */
    @Override
    public int deleteOrderItemByOrderItemId(Long orderItemId)
    {
        return orderItemMapper.deleteOrderItemByOrderItemId(orderItemId);
    }
}
